# Contributor: Alex Dowad <alexinbeijing@gmail.com>
# Maintainer: Alex Dowad <alexinbeijing@gmail.com>
pkgname=lua-stacktraceplus
pkgver=0.1.2
pkgrel=0
pkgdesc="Enhanced stack traces for Lua 5.1, 5.2, 5.3, LuaJIT, and OpenResty"
url="https://github.com/ignacio/StackTracePlus"
arch="noarch"
license="MIT"
source="$pkgname-$pkgver.tar.gz::https://github.com/ignacio/StackTracePlus/archive/refs/tags/$pkgver-1.tar.gz"
builddir="$srcdir/StackTracePlus-$pkgver-1"
checkdepends="lua5.1 luacheck"

check() {
	# Warning 213 is for unused loop variable; this has been fixed on master but not yet released
	# Warnings 611/614 are for trailing whitespace; sent PR to upstream (https://github.com/ignacio/StackTracePlus/pull/15)
	luacheck --no-max-line-length ./src/StackTracePlus.lua --ignore 213/i 611 614

	# StackTracePlus has a unit test suite which can be run with 'lua ./unittest/run.lua'
	# However, it requires the 'lunitx' test framework (https://github.com/dcurrie/lunit),
	# and we don't currently have lunitx packaged for Alpine Linux
}

package() {
	mkdir -p "$pkgdir/usr/share/lua/common"
	cp "$builddir/src/StackTracePlus.lua" "$pkgdir/usr/share/lua/common/"
}

sha512sums="
a8c8620f9d15ac9446c9d4c7d1741d547cb5e02d944979f8f6a961388ac9dd5ae61bc0262ffdc01ca792d5ca9eac85a391c728f576ae436604d0c8e52194733a  lua-stacktraceplus-0.1.2.tar.gz
"
